package com.pzh.assignment.common.bean.vo;

import com.pzh.assignment.entity.Menu;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class MenuVO {
    private Integer id;
    private String name;
    private String icon;
    private String path;
    private Boolean isShow;
    private Integer pid;
    private String router;
    private Map<String, String> authority;
    private List<MenuVO> children;

    public static MenuVO valueOf(Menu menu){
        MenuVO vo = new MenuVO();
        vo.setId(menu.getId());
        vo.setName(menu.getName());
        vo.setIcon(menu.getIcon());
        vo.setPath(menu.getPath());
        vo.setIsShow(menu.getIsShow());
        vo.setPid(menu.getPid());
        vo.setRouter(menu.getRouter());
        vo.setChildren(new ArrayList<>());
        return vo;
    }
}
